#ifndef _TDA_WAV_H_
#define _TDA_WAV_H_

#include "common.h"

#define BYTES_32BIT	4
#define BYTES_16BIT	2

#define MASK_BYTE1	0xFF

#define CHUNK_ID	"RIFF"
#define FORMAT		"WAVE"
#define SUBCHUNK_1_ID	"fmt "
#define SUBCHUNK_1_SIZE	16
#define AUDIO_FORMAT	1
#define NUM_CHANNELS	1
#define BLOCK_ALIGN	2
#define BITS_PER_SAMPLE	16
#define SUBCHUNK_2_ID	"data"


typedef struct{
int samples_qty;
int sample_frecuency;
float factor;
int * samples;
}adt_wav_t;

typedef enum{frec_8000,frec_9600,frec_11025,frec_12000,frec_16000,frec_22050,frec_24000,frec_32000,frec_44100,frec_48000,frec_88200,frec_96000}frec_t;

status_t adt_wav_new(adt_wav_t ** pp_adt_wav,float * samples,int samples_qty, int sample_frecuency, float factor);
status_t adt_wav_destroy(adt_wav_t ** pp_adt_wav);
status_t adt_wav_set_samples_qty(adt_wav_t * p_adt_wav, int samples_qty);
status_t adt_wav_set_sample_frecuency(adt_wav_t * p_adt_wav, int sample_frecuency);
status_t adt_wav_set_factor(adt_wav_t * p_adt_wav, float factor);

status_t adt_wav_save(adt_wav_t * p_adt_wav, FILE* fo);

status_t write_in_LE(void * data, int bytes, FILE * fo);

#endif
